<!--#Include File="Include.asp"--><%
'--------------------------------------
'Power By 方卡在线 @2010-2014 f02
'URL:http://www.fangka.net/
'EMail:admin@ifangka.com
'QQ:861118936
'版权所有 未经允许不得去除本版权信息
'--------------------------------------

Call CheckAdminType("0,1",UType)
Call CheckAdminLimit(ULimit,"o_Info",0)

Dim Fk_Info_Name,Fk_Info_Content

Types=Clng(Request.QueryString("Type"))

Select Case Types
	Case 1
		Call InfoList() '独立信息列表
	Case 2
		Call InfoAddForm() '添加独立信息表单
	Case 3
		Call InfoAddDo() '执行添加独立信息
	Case 4
		Call InfoEditForm() '修改独立信息表单
	Case 5
		Call InfoEditDo() '执行修改独立信息
	Case 6
		Call InfoDelDo() '执行删除独立信息
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：InfoList()
'作    用：独立信息列表
'==========================================
Sub InfoList()
%>
		<div id="rightNav">
			<ul>
				<li><a href="Info.asp?Type=2" target="dialog" width="900">添加独立信息</a></li>
			</ul>
		</div>
		<div id="searchLine" class="font_bold">
			独立信息管理
		</div>
		<table width="100%" bordercolor="#CCCCCC" border="1" cellspacing="0" cellpadding="0">
			<tr>
				<th align="center">ID</th>
				<th align="center">名称</th>
				<th align="center">调用</th>
				<th align="center">操作</th>
			</tr>
<%
	Sqlstr="Select Fk_Info_Id,Fk_Info_Name From [Fk_Info] Order By Fk_Info_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		i=1
		While Not Rs.Eof
%>
			<tr>
				<td height="20" align="center"><%=i%></td>
				<td>&nbsp;<%=Rs("Fk_Info_Name")%></td>
				<td align="center">{$Info(<%=Rs("Fk_Info_Id")%>)$}</th>
				<td align="center"><a href="Info.asp?Type=4&Id=<%=Rs("Fk_Info_Id")%>" target="dialog" width="900">修改</a> <a href="Info.asp?Type=6&Id=<%=Rs("Fk_Info_Id")%>" target="delete" confirmStr="您确认要删除“<%=Rs("Fk_Info_Name")%>”？此操作不可逆！" refreshUrl="Info.asp?Type=1" showStr="名称删除成功！">删除</a></td>
			</tr>
<%
			Rs.MoveNext
			i=i+1
		Wend
	Else
%>
			<tr>
				<td height="25" colspan="20" align="center">暂无记录</td>
			</tr>
<%
	End If
	Rs.Close
%>
			<tr>
				<td height="30" colspan="20">&nbsp;</td>
			</tr>
		</table>
		<div id="rightBottom">
		
		</div>
<%
End Sub

'==========================================
'函 数 名：InfoAddForm()
'作    用：添加独立信息表单
'==========================================
Sub InfoAddForm()
%>
<form id="InfoAdd" name="InfoAdd" method="post" target="ajax" action="Info.asp?Type=3" showStr="新独立信息添加成功！" refreshUrl="Info.asp?Type=1" boxClose="1">
<div id="title">添加新独立信息</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="6%" height="30" align="right">名称：</td>
			<td width="94%">&nbsp;<input name="Fk_Info_Name" type="text" class="input" id="Fk_Info_Name" /><span class="help" title="<p>独立信息名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
        <tr>
            <td height="30" align="right">内容：</td>
            <td>
<%
	If Fk_Site_Editor=0 Then
%>
				<textarea name="Fk_Info_Content" id="Fk_Info_Content" class="xheditor" rows="20" style="width:100%;"></textarea>
<%
	ElseIf Fk_Site_Editor=1 Then
%>
				<textarea name="Fk_Info_Content" id="Fk_Info_Content" class="ueditor" style="width:740px;height:300px;"></textarea>
				<script type="text/javascript">  
					UE.getEditor('Fk_Info_Content');
				</script>
<%
	End If
%>
			</td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="submit" class="button" name="Enter" id="Enter" value="添 加" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：InfoAddDo
'作    用：执行添加独立信息
'==============================
Sub InfoAddDo()
	Fk_Info_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Info_Name")))
	Fk_Info_Content=FKFun.EditorImgTry(Request.Form("Fk_Info_Content"))
	Call FKFun.JsonString(Fk_Info_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Info_Content,1,50,1,"请输入内容！","内容不能大于50个字符！")
	Sqlstr="Select Fk_Info_Id,Fk_Info_Name,Fk_Info_Content From [Fk_Info] Where Fk_Info_Name='"&Fk_Info_Name&"'"
	Rs.Open Sqlstr,Conn,1,3
	If Rs.Eof Then
		Application.Lock()
		Rs.AddNew()
		Rs("Fk_Info_Name")=Fk_Info_Name
		Rs("Fk_Info_Content")=Fk_Info_Content
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("该独立信息名称已经被占用！")
	End If
	Rs.Close
End Sub

'==========================================
'函 数 名：InfoEditForm()
'作    用：修改独立信息表单
'==========================================
Sub InfoEditForm()
	Id=Clng(Request.QueryString("Id"))
	Sqlstr="Select Fk_Info_Name,Fk_Info_Content From [Fk_Info] Where Fk_Info_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Fk_Info_Name=Rs("Fk_Info_Name")
		Fk_Info_Content=Rs("Fk_Info_Content")
	Else
		Rs.Close
		Call FKFun.ShowErr("独立信息不存在！",1)
	End If
	Rs.Close
%>
<form id="InfoEdit" name="InfoEdit" method="post" target="ajax" action="Info.asp?Type=5" showStr="独立信息修改成功！" refreshUrl="Info.asp?Type=1" boxClose="1">
<div id="title">修改独立信息</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="6%" height="30" align="right">名称：</td>
			<td width="84%">&nbsp;<input name="Fk_Info_Name" type="text" class="input" id="Fk_Info_Name" value="<%=Fk_Info_Name%>" /><span class="help" title="<p>独立信息名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
        <tr>
            <td height="30" align="right">内容：</td>
            <td>
<%
	If Fk_Site_Editor=0 Then
%>
				<textarea name="Fk_Info_Content" id="Fk_Info_Content" class="xheditor" rows="20" style="width:100%;"><%=Fk_Info_Content%></textarea>
<%
	ElseIf Fk_Site_Editor=1 Then
%>
				<textarea name="Fk_Info_Content" id="Fk_Info_Content" class="ueditor" style="width:740px;height:300px;"><%=Fk_Info_Content%></textarea>
				<script type="text/javascript">  
					UE.getEditor('Fk_Info_Content');
				</script>
<%
	End If
%>
			</td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="hidden" name="Id" value="<%=Id%>" />
	<input type="submit" class="button" name="Enter" id="Enter" value="修 改" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：InfoEditDo
'作    用：执行修改独立信息
'==============================
Sub InfoEditDo()
	Fk_Info_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Info_Name")))
	Fk_Info_Content=FKFun.EditorImgTry(Request.Form("Fk_Info_Content"))
	Id=Trim(Request.Form("Id"))
	Call FKFun.JsonString(Fk_Info_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Info_Content,1,50,1,"请输入内容！","内容不能大于50个字符！")
	Call FKFun.JsonNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_Info_Id,Fk_Info_Name,Fk_Info_Content From [Fk_Info] Where Fk_Info_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs("Fk_Info_Name")=Fk_Info_Name
		Rs("Fk_Info_Content")=Fk_Info_Content
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("要修改的独立信息不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：InfoDelDo
'作    用：执行删除独立信息
'==============================
Sub InfoDelDo()
	Id=Trim(Request.QueryString("Id"))
	Call FKFun.ShowNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_Info_Id From [Fk_Info] Where Fk_Info_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs.Delete()
		Application.UnLock()
		Response.Write("ok")
	Else
		Response.Write("要删除的独立信息不存在！")
	End If
	Rs.Close
End Sub

Call FKFun.PageEnd()
%>
